import request from "@/utils/requist";
// import CryptoJS from '@/utils/aes_util'

// 新登陆
export const doLogin = ({ name, password }) => {
  return request({
    method: "post",
    url: "/login",
    urlType: "api5",
    data: {
      username: name,
      password,
    },
  });
};

// 获取用户信息
export const getCurrentUserInfo = () => {
  return request({
    method: "get",
    url: "/getInfo",
    urlType: "api5",
  });
};

// 项目总览 table
export const projectOverview = (county, time = "") => {
  return request({
    method: "post",
    url: `/project/project/api/selectProjectDetail`,
    urlType: "api5",
    data: {
      county,
      time,
    },
  });
};

// 项目推送 table
export const projectPushList = (data) => {
  return request({
    method: "post",
    url: "/push/push/api/list",
    urlType: "api5",
    data,
  });
};

// 项目推送 数据更新
export const projectPushUpdate = (data) => {
  return request({
    method: "post",
    url: "/push/push",
    urlType: "api5",
    data,
  });
};

// 项目推送 流转
export const projectPushWanderAbout = (id) => {
  return request({
    method: "get",
    url: `/push/push/api/projectByTurnovere?id=${id}`,
    urlType: "api5",
  });
};

// 历史数据
export const projectHistoryList = (data) => {
  return request({
    method: "get",
    url: `/push/push/api/historyList?pageSize=${data.pageSize}&pageNum=${data.pageNum}`,
    urlType: "api5",
  });
};

// 项目推送 统计
export const projectPushTotal = () => {
  return request({
    method: "get",
    url: "/push/push/api/selectCountByStatus",
    urlType: "api5",
  });
};

// 项目推送 分发
export const projectPushDistribute = (data) => {
  return request({
    method: "post",
    url: "/push/push/api/projectByFenfa",
    urlType: "api5",
    data,
  });
};

// 项目推送 退回
export const projectPushBack = (data) => {
  return request({
    method: "post",
    url: "/push/push/api/projectByFallBack",
    urlType: "api5",
    data,
  });
};

// 项目推送 恢复
export const projectPushRestore = (id) => {
  return request({
    method: "get",
    url: `/push/push/api/projectByRecover?id=${id}`,
    urlType: "api5",
  });
};

// 项目推送 暂停或终止
export const projectPushPause = (id) => {
  return request({
    method: "get",
    url: `/push/push/api/projectByPause?id=${id}`,
    urlType: "api5",
  });
};

// 重点项目 统计
export const keyProjectStatistics = () => {
  return request({
    method: "get",
    url: "/keyproject/keyproject/api/selectProjectCount",
    urlType: "api5",
  });
};

// 重点项目 table
export const keyProjectList = (data = {}) => {
  return request({
    method: "post",
    url: "/keyproject/keyproject/api/list",
    urlType: "api5",
    data,
  });
};

// 重点项目 添加
export const createKeyProject = (data) => {
  return request({
    method: "post",
    url: "/keyproject/keyproject/api/adds",
    urlType: "api5",
    data,
  });
};

// 重点项目 详情
export const detailKeyProject = (id) => {
  return request({
    method: "get",
    url: `/keyproject/keyproject/api/findById?id=${id}`,
    urlType: "api5"
  });
};

// 重点项目 修改
export const updatelKeyProject = (data) => {
  return request({
    method: "post",
    url: `/keyproject/keyproject/api/updates`,
    urlType: "api5",
    data
  });
};

// 重点项目 流程列表
export const keyProjectFlowChart = (data) => {
  return request({
    method: "post",
    url: "/flow/flow/selectProjectFlow",
    urlType: "api5",
    data,
  });
};

// 重点项目 工作动态
export const keyProjectWork = (data) => {
  return request({
    method: "post",
    url: "/dynamics/dynamics/api/list",
    urlType: "api5",
    data,
  });
};

// 重点项目 导出
export const keyProjectExport = (data) => {
  return request({
    method: "post",
    url: "/keyproject/keyproject/export",
    urlType: "api5",
    data,
    responseType: "blob",
  });
};

// 数据 导出
export const dataExport = (data) => {
  return request({
    method: "post",
    url: "/push/push/export",
    urlType: "api5",
    data,
    responseType: "blob",
  });
};

// 台账管理 Ledger management
export const ledgerManagementList = (data) => {
  return request({
    method: "post",
    url: "/book/book/api/list",
    urlType: "api5",
    data,
  });
};

// 台账管理 删除
export const ledgerManagementRemove = (ids) => {
  return request({
    method: "delete",
    url: `/book/book/${ids}`,
    urlType: "api5",
  });
};

// 台账管理 数据导入
export const ledgerUpload = (data) => {
  return request({
    method: "post",
    url: `/book/book/api/uploadExcel`,
    urlType: "api5",
    data,
  });
};

// 台账管理 数据导出
export const ledgerExport = () => {
  return request({
    method: "post",
    url: `/book/book/api/export`,
    urlType: "api5",
    responseType: "blob",
  });
};

// 台账管理 修改
export const ledgerUpdate = (data) => {
  return request({
    method: "put",
    url: `/book/book`,
    urlType: "api5",
    data
  });
};

// 文件上传
export const fileUploadApi = (data) => {
  return request({
    method: "post",
    url: "/common/upload",
    urlType: "api5",
    data,
  });
};

// 文件下载
export const fileDownload = (fileName) => {
  return request({
    method: "get",
    url: `/common/download?fileName=${fileName}`,
    urlType: "api5",
  });
};

// 模版下载
export const fileModelDownload = (
  fileName = "/profile/upload/2023/11/29/台账_20231129205807A001.xlsx"
) => {
  return request({
    method: "get",
    url: `/common/download?fileName=${fileName}`,
    urlType: "api5",
    responseType: "blob",
  });
};

// 统计分析 指标分析 indexAnalysis
export const indexAnalysis = (data) => {
  return request({
    method: "get",
    url: `/xzxl/xzxl/api/indexAnalysis?time=${data.time}&type=${data.type}`,
    urlType: "api5",
  });
};

// 统计分析 项目分析 projectAnalysisData
export const projectAnalysisData = (data) => {
  return request({
    method: "post",
    url: `/project/project/projectStatistics`,
    urlType: "api5",
    data,
  });
};
